import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

/** 测试json参数传递 */
export const testJson = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("devTest/testJson"),
    { data },
    {
      headers: {
        "Content-Type": "application/json",
        "X-Requested-With": "XMLHttpRequest"
      }
    }
  );
};

/** 测试get参数传递 */
export const testGet = (data?: object) => {
  return http.request<any>("get", baseUrlApi("devTest/testGet"), { data });
};

/** 测试post参数传递 */
export const testPost = (data?: object) => {
  return http.request<any>("post", baseUrlApi("devTest/testPost"), { data });
};

/** 测试delete参数传递 */
export const testDelete = (data?: object) => {
  return http.request<any>("delete", baseUrlApi("devTest/testDelete"), {
    data
  });
};

/** 测试Restful风格参数传递 */
export const testRestfulGet = (data?: object) => {
  return http.request<any>("get", baseUrlApi("devTest/testRestfulGet/1/role"), {
    data
  });
};
